<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS语法_for语句</title>

    <script>

        // 1 ~ 100 的和
        var sum = 0;
        for (var a = 1; a <= 100; a++) {
            sum += a;
        }
        alert(sum);
    </script>
</head>
<body>

</body>
</html>